import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/financeSettlement/addOrSave',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/financeSettlement/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/financeSettlement/addOrSave',
    method: 'post',
    data
  })
}

export function copy(data) {
  return request({
    url: 'api/financeSettlement/copy',
    method: 'post',
    data
  })
}

export function exportDe(data) {
  return request({
    url: 'api/financeSettlement/export',
    method: 'post',
    data
  })
}

export function importDe(data) {
  return request({
    url: 'api/financeSettlement/import',
    method: 'post',
    data
  })
}

export function passOrReject(data) {
  const obj = {
    url: 'api/financeSettlement/passOrReject',
    method: 'post',
    data
  }
  return request(obj)
}

// 抽单详情
export function orderDetail(params) {
  const obj = {
    url: 'api/financeSettlement/order',
    method: 'get',
    params
  }
  return request(obj)
}

// 抽单详情
export function queryReceiptAndPayment(data) {
  const obj = {
    url: 'api/financeSettlement/queryReceiptAndPayment',
    method: 'post',
    data
  }
  return request(obj)
}

// 抽单详情
export function getOrder(params) {
  const obj = {
    url: 'api/financeSettlement/order',
    method: 'get',
    params
  }
  return request(obj)
}
// 保存
export function addOrSave(data) {
  const obj = {
    url: '/api/financeSettlement/addOrSave',
    method: 'post',
    data
  }
  return request(obj)
}
export function print(data) {
  const obj = {
    url: 'api/financeSettlement/print',
    method: 'post',
    responseType: 'blob',
    data
  }
  return request(obj)
}
export function collectPrint(data) {
  const obj = {
    url: '/api/financeSettlement/collectPrint',
    method: 'post',
    responseType: 'blob',
    data
  }
  return request(obj)
}
export default { add, edit, copy, exportDe, importDe, del, passOrReject, orderDetail, queryReceiptAndPayment, getOrder, addOrSave, print ,collectPrint}
